<?php
$Query = "SELECT awal,skada FROM $SourceDB.$SkadaTableSource WHERE awal<>0";
$MyResult = $DBConnection->dbc->get_results($Query,ARRAY_A);
if ($MyResult) {
		foreach ($MyResult as $RowResult) {
		  $SQL[] = "UPDATE tblcoa SET awal={$RowResult['awal']} WHERE skada='{$RowResult['skada']}' AND ledger=$Year";
		}
		$SQL[] = "UPDATE tblcoa SET awal=awal*-1 WHERE skada like '3%' or skada like '4%' or skada like '5%' AND ledger=$Year";
}

//Execute Query MEssage
for($x=0;$x<count($SQL);$x++){
	$DBConnection->dbc->query($SQL[$x]);
//	print $SQL[$x]."<br>\n"; 
}

?>
